import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidPooledConnection;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import com.sun.org.apache.xpath.internal.SourceTree;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.sql.Connection;
import java.sql.SQLException;

public class MyTest {

    @Test
    public void c3p0() throws SQLException {
        ClassPathXmlApplicationContext applicationContext=new ClassPathXmlApplicationContext("spring.xml");
        ComboPooledDataSource c3p0 = (ComboPooledDataSource) applicationContext.getBean("c3p0");
        Connection connection = c3p0.getConnection();
        System.out.println(connection);
        applicationContext.close();
    }


    @Test
    public void druid() throws SQLException {
        ClassPathXmlApplicationContext applicationContext=new ClassPathXmlApplicationContext("spring.xml");
        DruidDataSource druid = (DruidDataSource) applicationContext.getBean("druid");
        DruidPooledConnection connection = druid.getConnection();
        System.out.println(connection);
        applicationContext.close();
    }



}
